import * as React from 'react';
import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {TransitionPresets} from '@react-navigation/stack';
import {View, StatusBar, Text, Button} from 'react-native';

import Tabs from "../pages/tabs"
import Public from "../pages/public"

import Main from '../pages/main';
import Login from '../pages/login';
import ArticleList from '../pages/homePkg/articleList';
import ArticleInfo from '../pages/homePkg/articleInfo';
import AddressList from '../pages/homePkg/addressList';
import AddressInfo from '../pages/homePkg/addressInfo';
import CommodityList from '../pages/homePkg/commodityList';
import CommodityInfo from '../pages/homePkg/commodityInfo';

const Stack = createNativeStackNavigator();

function HomeScreen(props: any) {
  const {navigation} = props;
  return (
    <View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
      <Text>Home Screen</Text>
      <Button
        onPress={() => navigation.navigate('List')}
        title="Go List"></Button>
    </View>
  );
}

function ListScreen(props:any) {
  const {navigation} = props;
  return (
    <View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
      <Text>List Screen</Text>
      <Button
        onPress={() => navigation.goBack()}
        title="返回"></Button>
    </View>
  );
}
function DetailScreen() {
  return (
    <View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
      <Text>Detail Screen</Text>
    </View>
  );
}

export default () => {
  return (
    <Stack.Navigator initialRouteName="Main">
      <Stack.Screen
        name="Main"
        options={{
          headerShown: false,//隐藏头部导航栏
        }}
        component={Tabs}
      />
      <Stack.Screen
        name="List"
        options={{
          headerShown: false,
        }}
        component={ListScreen}
      />
       <Stack.Screen
        name="Public"
        options={{
          headerShown: false,
        }}
        component={Public}
      />
      <Stack.Screen name="Detail" component={DetailScreen} />
    </Stack.Navigator>
  );
};
